package ar.edu.caece.compiler.grammar.factories;

import ar.edu.caece.compiler.grammar.AbstractTokenVisitorFactory;
import ar.edu.caece.compiler.grammar.TokenVisitor;

public class LISTAPROPFactory extends AbstractTokenVisitorFactory {

	private static LISTAPROPFactory INSTANCE;
	
	private LISTAPROP1Factory listaprop1Factory;
	private LambdaFactory lambdaFactory;
	
	public static LISTAPROPFactory getInstance() throws Exception {
		if(INSTANCE==null) INSTANCE = new LISTAPROPFactory();
		return INSTANCE;
	}
	
	private Initializer initializer = new Initializer() {
		
		@Override
		public void init() throws Exception {
			initializer = NoOperationInitializer.getInstance();
			listaprop1Factory = LISTAPROP1Factory.getInstance();
			lambdaFactory = LambdaFactory.getInstance();
		}
	};
	
	private LISTAPROPFactory() throws Exception {

	}
	
	@Override
	public TokenVisitor makeChainedVisitor(
			final TokenVisitor siguiente) throws Exception {
		initializer.init();

		return listaprop1Factory.makeChainedVisitor(lambdaFactory.makeChainedVisitor(siguiente));
	
	}
	@Override
	public TokenVisitor makeVisitor() throws Exception {
		initializer.init();

		return listaprop1Factory.makeChainedVisitor(lambdaFactory.makeVisitor());
	}
	
	
}
